<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>宏的使用</title>
</head>

<!-- 定义宏 -->
{% macro inp(type,name="",value="") %}
    <input type="{{type}}" name="{{name}}" value="{{value}}">
{% endmacro %}

<body>
    <h1>宏的使用</h1>

    <table>
        <tr>
            <td>用户名：</td><td><input type="text" name="" value=""></td>
        </tr>
        <tr>
            <td>密码：</td><td><input type="password" name="" value=""></td>
        </tr>
        <tr>
            <td><input type="submit" value="登录"></td>
        </tr>
    </table>

    <hr>

    <!-- 使用宏 -->
    <table>
        <tr>
            <td>用户名：</td><td>{{inp('text','uname')}}</td>
        </tr>
        <tr>
            <td>密码：</td><td>{{inp('password','pwd')}}</td>
        </tr>
        <tr>
            <td>{{inp('submit',value='登录')}}</td>
        </tr>
    </table>

</body>
</html>